package com.x.erp.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.x.erp.manage.ProvinceManage;
import com.x.erp.model.Province;
import com.x.erp.rpc.ProvinceRpcService;
import com.x.framework.exception.BusinessException;
import com.x.framework.exception.ExceptionCode;
import com.x.framework.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Service(interfaceName = "com.x.erp.rpc.ProvinceRpcService", timeout = 60000)
public class ProvinceService extends BaseService implements ProvinceRpcService {

	@Autowired
	private ProvinceManage provinceManage;

	public ProvinceService() {

	}

	@Override
	public List<Province> selectProvinceList(Province province) {
		try {
			return provinceManage.selectProvinceList(province);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0001, e);
		}
	}

	/**
	 * 获取启辕合作市场的省份列表(带城市)
	 * @param province
	 * @return
	 * @throws Exception
	 */
	@Override
	public List<Province> selectCooperationProvinceList(Province province) {
		try {
			return provinceManage.selectCooperationProvinceList(province);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0001, e);
		}
	}
}
